package Form::Field::OcfCentrePopupMenu;

use strict;
use warnings;
use base qw(Rose::HTML::Form::Field::PopUpMenu);
use OCF::Centre;
use OCF::Centre::Manager;

sub new {
	my $class = shift;
	my $self  = $class->SUPER::new(@_);

	my $centres = OCF::Centre::Manager->get_centres( 'sort_by' => 'year_affiliated' );
	# the initial 'null' option
	$self->add_options( undef => 'Select one' );
	foreach my $centre ( @{$centres} ) {
		$self->add_options( $centre->id => $centre->name );
	}
	bless( $self, $class );
	return $self;
} ## end sub new

1;
